import { createRoutes } from '@/utils/core';
import BasicLayout from '@/layouts/BasicLayout';
import UserLayout from '@/layouts/UserLayout';
import Page403 from './Pages/403';
import NotFound from './Pages/404';
import Page500 from './Pages/500';

import Login from './Login';

import Blank from './Blank';

import Articles from './Articles';
import Banners from './Banners';

import User from './Users';
import Roles from './Roles';
import Menus from './Menus';

import Lessons from './Lessons';
import LessonsDetail from './Lessons/routers/Detail';
import Exams from './Exams';
import ExamsDetail from './Exams/routers/Detail';

import Teachers from './Teachers';
import Students from './Students';
import Classes from './Classes';
import StudentState from './StudentState';
import ClassState from './ClassState';
import CourseState from './CourseState';
import StudentStateDetail from './StudentState/routers/Detail';
import Mconfig from './Mconfig';

/**
 * 主路由配置
 * 
 * path 路由地址
 * component 组件
 * indexRoute 默认显示路由
 * childRoutes 所有子路由
 * NotFound 路由要放到最下面，当所有路由当没匹配到时会进入这个页面
 */
const routesConfig = app => [
  {
    path: '/sign',
    title: '登录',
    indexRoute: '/sign/login',
    component: UserLayout,
    childRoutes: [
      Login(app),
      // Register(app),
      NotFound()
    ]
  },
  {
    path: '/',
    title: '系统中心',
    component: BasicLayout,
    indexRoute: '/blank',
    childRoutes: [
      Blank(app),
      Articles(app),
      Banners(app),
      User(app),
      Roles(app),
      Menus(app),
      Lessons(app),
      LessonsDetail(app),
      Exams(app),
      ExamsDetail(app),
      Teachers(app),
      Students(app),
      Classes(app),
      StudentState(app),
      StudentStateDetail(app),
      ClassState(app),
      CourseState(app),
      Mconfig(app),
      Page403(app),
      Page500(app),
      NotFound()
    ]
  }
];

export default app => createRoutes(app, routesConfig);
